package test.nettys.nio;

import java.nio.ByteBuffer;

/**
 * @Author wangshaopeng
 * @Date 2021/7/19
 */
public class NioTest5 {

    public static void main(String[] args) {
        ByteBuffer buffer = ByteBuffer.allocate(64);
        buffer.putInt(1);
        buffer.putDouble(1.1);
        buffer.putChar('你');


        buffer.flip();


        while (buffer.hasRemaining()){
            byte b = buffer.get();

            System.out.println(b);
        }

        buffer.flip();

        System.out.println(buffer.getInt());
        System.out.println(buffer.getDouble());
        System.out.println(buffer.getChar());


    }

}
